package com.android.fragmentdemo.adapters
import android.util.Log
import com.android.fragmentdemo.R
import com.android.fragmentdemo.databinding.RvCustomItemLayoutBinding
import com.hengfoxwolf.commonbase.base.adapter.BaseRvAdapter

class CustomLayoutManagerAdapter() : BaseRvAdapter<String, RvCustomItemLayoutBinding>() {

    override fun getLayoutId(): Int = R.layout.rv_custom_item_layout

    override fun bindData(holder: ViewHolder, dataItem: String, position: Int) {

        holder.binding.itemTvContent.text = dataItem

        Log.d("tag--tag", "position:${position}")
    }

    override fun listenerWithBinding(binding: RvCustomItemLayoutBinding) {
        super.listenerWithBinding(binding)
        Log.d("tag--tag", "id:${binding.root.id}")
        binding.itemTvContent.setOnClickListener {

            mOnItemClickListener?.onItemClick(
                binding.root.tag as String, binding.root.id,
                binding.itemTvContent.id
            )

            Log.d("tag--tag", "x:${binding.root.x}")
            Log.d("tag--tag", "y:${binding.root.y}")
            Log.d("tag--tag", "width:${binding.root.width}")
            Log.d("tag--tag", "height:${binding.root.height}")
        }
    }
}